package com.unionpay.mobile.android.pboctransaction.sdapdu;

import android.content.Context;
import android.util.Log;
import com.unionpay.mobile.android.pboctransaction.AppIdentification;
import com.unionpay.mobile.android.pboctransaction.d;
import com.unionpay.mobile.android.pboctransaction.e;
import com.unionpay.mobile.android.utils.h;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;

public final class a
  implements com.unionpay.mobile.android.pboctransaction.c
{
  NativeSDWriter a = null;
  private Context b = null;
  private boolean c = false;

  private static ArrayList<com.unionpay.mobile.android.model.c> b(d paramd)
  {
    if (paramd.a() == null)
    {
      Log.e("uppay", " select UPCard failed!!!!");
      return null;
    }
    String str1 = paramd.c();
    if (str1 == null)
    {
      Log.e("uppay", " getBankCardFileEntry failed!!!!");
      return null;
    }
    byte[] arrayOfByte = e.a(str1);
    int i = (0xFF & arrayOfByte[0]) << 24 | (0xFF & arrayOfByte[1]) << 16;
    int j = -2147483648;
    int k = 0;
    int m = 0;
    if (m < 10)
      if ((j & i) != 0)
        break label314;
    label314: for (int i3 = k + 1; ; i3 = k)
    {
      j >>>= 1;
      m++;
      k = i3;
      break;
      if (k <= 0)
        return null;
      ArrayList localArrayList = new ArrayList(k);
      int n = -2147483648;
      int i1 = 1;
      while (true)
        if ((i1 <= k) && (i1 < 11))
        {
          String str2;
          String str3;
          if ((i & n) == 0)
          {
            str2 = paramd.a(i1, com.unionpay.mobile.android.utils.b.a());
            if ((str2 != null) && (str2.length() > 0))
              str3 = e.d(str2.substring(0, 40));
          }
          try
          {
            str4 = new String(e.a(str3), "gbk");
            String str5 = str2.substring(40, 60);
            localArrayList.add(new com.unionpay.mobile.android.model.a(8, Integer.toString(i1), str4, e.c(str5), 2));
            h.c("uppay", i1 + "----" + str5);
            int i2 = i1 + 1;
            n >>>= 1;
            i1 = i2;
          }
          catch (UnsupportedEncodingException localUnsupportedEncodingException)
          {
            while (true)
            {
              localUnsupportedEncodingException.printStackTrace();
              String str4 = str3;
            }
          }
        }
      return localArrayList;
    }
  }

  public final ArrayList<com.unionpay.mobile.android.model.c> a(d paramd)
  {
    h.c("uppay", "SDEngine.readList() +++");
    if (!this.c)
      return null;
    ArrayList localArrayList1 = new ArrayList();
    String str = paramd.a(new AppIdentification("A0000003330101", "1.0"));
    Object localObject = null;
    if (str != null)
    {
      int i = str.length();
      localObject = null;
      if (i > 0)
      {
        ArrayList localArrayList3 = new ArrayList(1);
        localArrayList3.add(new com.unionpay.mobile.android.model.a(8, "A0000003330101", "", e.c(str), 1));
        h.c("uppay", "A0000003330101" + "----" + str);
        localObject = localArrayList3;
      }
    }
    if ((localObject != null) && (localObject.size() > 0))
      localArrayList1.addAll(localObject);
    ArrayList localArrayList2 = b(paramd);
    if ((localArrayList2 != null) && (localArrayList2.size() > 0))
      localArrayList1.addAll(localArrayList2);
    h.c("uppay", "SDEngine.readList() ---");
    return localArrayList1;
  }

  public final void a()
  {
  }

  public final void a(com.unionpay.mobile.android.pboctransaction.b paramb, Context paramContext)
  {
    this.b = paramContext;
    if (paramb != null)
      paramb.a();
  }

  public final byte[] a(byte[] paramArrayOfByte, int paramInt)
  {
    String str = "";
    if (this.a != null)
      str = this.a.a(e.a(paramArrayOfByte, paramArrayOfByte.length));
    return e.a(str);
  }

  public final void b()
  {
    this.a = new NativeSDWriter();
    b.a();
    ArrayList localArrayList = new ArrayList();
    String[] arrayOfString = b.a;
    int i = arrayOfString.length;
    for (int j = 0; j < i; j++)
      localArrayList.add(arrayOfString[j]);
    this.c = this.a.a(localArrayList);
  }

  public final void c()
  {
    if (this.a != null)
      this.a.a();
  }

  public final void d()
  {
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.unionpay.mobile.android.pboctransaction.sdapdu.a
 * JD-Core Version:    0.6.2
 */